package coop.bancocredicoop.proyectos.gd

import grails.test.mixin.TestFor
import spock.lang.*

import coop.bancocredicoop.proyectos.gd.DocumentFilesHandler

@TestFor(DocumentController)
class DocumentControllerSpec extends Specification {

    def setup() {
    }

    def cleanup() {
    }

    void "test file list is showed"() {
        given:
        def mockedFileList = [[fileName: 'FileTest1.pdf'],
                              [fileName: 'FileTest2.pdf']] 
        DocumentFilesHandler.metaClass.listFiles = { -> mockedFileList }
        when:
        controller.createNew()
        then:
        view == '/document/fileList'
        model.files == mockedFileList
    }
}
